package com.linkage.educloud.ah.mvp.model.dynamic;

import com.linkage.educloud.ah.http.BaseApiResult;
import com.linkage.educloud.ah.http.Method;
import com.linkage.educloud.ah.mvp.contract.dynamic.IDynamicDetailContract;
import com.linkage.educloud.ah.mvp.contract.dynamic.IDynamicListContract;
import com.zhouyou.http.EasyHttp;
import com.zhouyou.http.callback.CallClazzProxy;
import com.zhouyou.http.model.HttpParams;

import io.reactivex.Observable;

/**
 * Created by Mr'Tang on 2018/11/20.
 */

public class DynamicDetailModel implements IDynamicDetailContract.IModel {

    @Override
    public Observable<String> request(Method method, boolean isToken, HttpParams params) {
        switch (method) {
            case GET:
                return EasyHttp.get("")
                        .params(params)
                        .accessToken(isToken)
                        .execute(new CallClazzProxy<BaseApiResult<String>, String>(String.class) {
                        });
            case POST:
            default:
                return EasyHttp.post("")
                        .params(params)
                        .accessToken(isToken)
                        .execute(new CallClazzProxy<BaseApiResult<String>, String>(String.class) {
                        });
        }
    }

}
